home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Programming / AmigaTalk / Intuition / PushButton.st < prev    next >
Text File  |  2000-02-16  |  2KB  |  82 lines

  1. "-------------------------------------------------------"
  2. " PushButton Class is a custom look for boolean gadgets."
  3. "-------------------------------------------------------"
  4.  
  5. Class PushButton :BoolGadget  ! renderName selectName !
  6. [
  7.    " gadgetValues is an Array with the following fields: 
  8.        NextGadget, LeftEdge, TopEdge, Width, Height, Flags,
  9.        Activation, GadgetType, GadgetText, GadgetID:
  10.    "
  11.    initialize: gadgetName withArray: gadgetValues
  12.       ! ng le te w h f a gt gr sr txt id tb1 tb2 a1 a2 a3 a4 !
  13.  
  14.       ng  <- gadgetValues at: 1.
  15.       le  <- gadgetValues at: 2.
  16.       te  <- gadgetValues at: 3.
  17.  
  18.       w   <- gadgetValues at: 4.
  19.       h   <- gadgetValues at: 5.
  20.       f   <- gadgetValues at: 6.
  21.       a   <- gadgetValues at: 7.
  22.       gt  <- gadgetValues at: 8.
  23.       txt <- gadgetValues at: 9.
  24.       id  <- gadgetValues at: 10.
  25.       a1  <- Array new: 12.
  26.       a2  <- Array new: 8.
  27.       a3  <- Array new: 12.
  28.       a4  <- Array new: 8.
  29.       gr  <- Border new.
  30.       sr  <- Border new.
  31.       tb1 <- Border new.
  32.       tb2 <- Border new.
  33.  
  34.       a1 <- #( 0 0 0 0 0 0 0 1 1 1 1 0 ).  "White Top-Left Border:"
  35.       a1 at: 2  put: h.
  36.       a1 at: 5  put: w.
  37.       a1 at: 7  put: (w - 1).
  38.       a1 at: 12 put: (h - 1).
  39.  
  40.       a2 <- #( 0 0 2 0 0 6 0 'NULL' ).      
  41.       a2 at: 7 put: a1.
  42.       
  43.       tb1 initialize: 'tb1' withArray: a2.
  44.  
  45.       a3 <- #( 0 0 0 0 0 0 1 0 0 0 0 0 ).  "Black Right-Bottom Border:"
  46.       a3 at: 1  put: w.
  47.       a3 at: 3  put: w.
  48.       a3 at: 4  put: h.
  49.       a3 at: 6  put: h.
  50.       a3 at: 8  put: (h - 1).
  51.       a3 at: 9  put: (w - 1).
  52.       a3 at: 10 put: (h - 1).
  53.       a3 at: 11 put: (w - 1).
  54.  
  55.       a4 <- #( 0 0 1 0 0 6 0 0 ).
  56.       a4 at: 7 put: a3.
  57.       a4 at: 8 put: 'tb1'.
  58.  
  59.       gr  initialize: (gadgetName,'Bdr1') withArray: a4.
  60.  
  61.  
  62.       "Now for the Select-complement Border:"
  63.       a2 at: 3 put: 1.         "Black Top-Left Border:"
  64.       a2 at: 7 put: a1.
  65.       
  66.       tb2 initialize: 'tb2' withArray: a2.
  67.  
  68.       a4 at: 3 put: 2.         "White Right-Bottom Border:"      
  69.       a4 at: 7 put: a3.
  70.       a4 at: 8 put: 'tb2'.
  71.  
  72.       sr  initialize: (gadgetName,'Bdr2') withArray: a4.
  73.                         
  74.       gt         <- ((gt bitAnd: 16rF0F0) + 1).
  75.       f          <- ((f  bitAnd: 16rFFF0) + 2).
  76.       renderName <- gr.
  77.       selectName <- sr.
  78.       
  79.       super initialize: gadgetName 
  80.             withArray:  #(ng le te w h f a gt gr sr txt id)
  81. ]
  82.